package _3ChapterThree._1SelfEncapsulateField.newObject;

public class CappedRange extends IntRange {
    private int _cap;

    public CappedRange(int low, int high, int cap) {
        super(low, high);
        this._cap = cap;
    }

    public int get_cap() {
        return _cap;
    }

    @Override
    public int get_high() {
        return Math.min(get_cap(), super.get_high());
    }
}
